# 访问估计的顶点法向量

import open3d as o3d
import numpy as np

# Load data
demo_crop_data = o3d.data.DemoCropPointCloud()
pcd = o3d.io.read_point_cloud(demo_crop_data.point_cloud_path)
vol = o3d.visualization.read_selection_polygon_volume(demo_crop_data.cropped_json_path)
chair = vol.crop_point_cloud(pcd)

aabb = chair.get_axis_aligned_bounding_box()  # 获取轴对齐包围盒
aabb.color = (1, 0, 0)  # 设置包围盒颜色为红色
obb = chair.get_oriented_bounding_box()      # 获取有向包围盒
obb.color = (0, 1, 0)  # 设置包围盒颜色为绿色
o3d.visualization.draw_geometries([chair, aabb, obb],  # 可视化椅子和两个包围盒
                                  zoom=0.7,
                                  front=[0.5439, -0.2333, -0.8060],
                                  lookat=[2.4615, 2.1331, 1.338],
                                  up=[-0.1781, -0.9708, 0.1688])